/*
 * ProgressStatus.cpp
 *
 *  Created on: Dec 25, 2014
 *      Authors: Avihay Avitan & Stefan Farcas
 */

#include "ProgressStatus.h"

namespace ProgressStatusSpace {

/**
 * initiate a fake status with "NONE" arguments and type INF
 */
ProgressStatus::ProgressStatus()
{
	this->type=ProgressStatusType::INF;
	this->sclass="NONE";
	this->function="NONE";
	this->content="NONE";
	this->fromConsule=false;
	this->passRelated=false;
	this->timeStampString = getNowTimeStamp();
	this->timeStampLongSec=getNowLongTimeSeconds();
	this->timeStampLongNanos=getNowLongTimeNanos();
	isToPublish = false;
}
/**
 * initiate the object with the required values, except time - will be defined as now
 * type - type of the status (INF,WRN,ERR)
 * sclass - the name of the class the status was initiated
 * function - the name of the function the status was initiated
 * content- short sentence represent the status
 * fromConsule - true if the status was printed to console
 * passRelated - true if the status related to a specific pass with satellite
 */
ProgressStatus::ProgressStatus(ProgressStatusType type ,string sclass , string function , string content, bool fromConsule, bool passRelated)
{
	this->type=type;
	this->sclass=sclass;
	this->function=function;
	this->content=content;
	this->fromConsule=fromConsule;
	this->passRelated=passRelated;
	this->timeStampString = getNowTimeStamp();
	this->timeStampLongSec=getNowLongTimeSeconds();
	this->timeStampLongNanos=getNowLongTimeNanos();
	isToPublish = true;
}

/**
 * initiate the object with the required values
 * timeStampLongSec - the status time in seconds
 * timeStampLongNanos - the status time in nanos
 * type - type of the status (INF,WRN,ERR)
 * sclass - the name of the class the status was initiated
 * function - the name of the function the status was initiated
 * content- short sentence represent the status
 * fromConsule - true if the status was printed to console
 * passRelated - true if the status related to a specific pass with satellite
 */
ProgressStatus::ProgressStatus(long timeStampLongSec,long timeStampLongNanos,ProgressStatusType type ,string sclass , string function , string content, bool fromConsule, bool passRelated)
{
	this->type=type;
	this->sclass=sclass;
	this->function=function;
	this->content=content;
	this->fromConsule=fromConsule;
	this->passRelated=passRelated;
	this->timeStampString = getTimeStampOf(timeStampLongSec,timeStampLongNanos);
	this->timeStampLongSec=timeStampLongSec;
	this->timeStampLongNanos=timeStampLongNanos;
	isToPublish = true;
}

/**
 * reset the object with the required values
 * timeStampLongSec - the status time in seconds
 * timeStampLongNanos - the status time in nanos
 * type - type of the status (INF,WRN,ERR)
 * sclass - the name of the class the status was initiated
 * function - the name of the function the status was initiated
 * content- short sentence represent the status
 * fromConsule - true if the status was printed to console
 * passRelated - true if the status related to a specific pass with satellite
 */
void ProgressStatus::setProgressStatus(long timeStampLongSec,long timeStampLongNanos,ProgressStatusType type ,string sclass , string function , string content, bool fromConsule, bool passRelated)
{
	this->type=type;
	this->sclass=sclass;
	this->function=function;
	this->content=content;
	this->fromConsule=fromConsule;
	this->passRelated=passRelated;
	this->timeStampString = getTimeStampOf(timeStampLongSec,timeStampLongNanos);
	this->timeStampLongSec=timeStampLongSec;
	this->timeStampLongNanos=timeStampLongNanos;
	isToPublish = true;
}

ProgressStatus::~ProgressStatus() {
	// TODO Auto-generated destructor stub
}

//////////////////////////// Getters & Setters

ProgressStatusType ProgressStatus::getProgressStatusType()
{
	return this->type;
}
long ProgressStatus::getTimeStampLongSec()
{
	return this->timeStampLongSec;
}
long ProgressStatus::getTimeStampLongNanos()
{
	return this->timeStampLongNanos;
}
string ProgressStatus::getTimeStampString()
{
	return this->timeStampString;
}
string ProgressStatus::getClass()
{
	return this->sclass;

}
string ProgressStatus::getFunction()
{
	return this->function;
}
string ProgressStatus::getContent()
{
	return this->content;
}
bool ProgressStatus::isFromConsole()
{
	return this->fromConsule;
}
bool ProgressStatus::isPassRelated()
{
	return this->passRelated;
}

void ProgressStatus::setIsFromConsole(bool isFromConsole)
{
	this->fromConsule = isFromConsole;
}

bool ProgressStatus::getIsToPublish()
{
	return this->isToPublish;
}
void ProgressStatus::setIsToPublish(bool isToPublish)
{
	this->isToPublish = isToPublish;
}

} /* namespace ProgressStatusSpace */
